package com.panda.mall.common.mallOrder.enums;

import com.panda.mall.common.base.EnumInterface;
import lombok.Getter;

/**
 * author: tcy
 * description:支付方式枚举
 */
public enum PayTypeEnum implements EnumInterface {

    ALIPAY("Alipay",1,"支付宝"),
    WECHAT("WeChat",2,"微信"),
    UNIONPAY("UnionPay",3,"银联"),
    ARRIVEDPAY("ArrivedPay",4,"货到付款");

    /**
     * 编码
     */
    @Getter
    protected String code;

    /**
     * 值
     */
    @Getter
    protected Integer value;


    /**
     * 键
     */
    @Getter
    protected String key;

    PayTypeEnum(String code, int value, String key) {
        this.code = code;
        this.value = value;
        this.key = key;
    }

    public static PayTypeEnum getByValue(Integer value) {

        PayTypeEnum baseEnum = null;

        for (PayTypeEnum item : values()) {
            if (item.getValue().equals(value)) {
                baseEnum = item;
                continue;
            }
        }
        return baseEnum;
    }

}
